<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>my</title>
    <link rel="stylesheet" href="css/my.css">
</head>
<body>
	
	<% if(session.getAttribute("USER_SESSION")==null){
		response.sendRedirect("login.jsp");
	}%>
	
	<jsp:include page="top.jsp"></jsp:include>

    <div class="my">
        <div class="my-list">
            <a href="my.jsp"><p>个人信息</p></a>
            <a href="lostnews.jsp"><p class="first">发布信息</p></a>
            <a href="${pageContext.request.contextPath}/userLost"><p>已发布</p></a>
            <a href="${pageContext.request.contextPath}/showNews"><p>消息列表</p></a>
        </div>
        <div class="my-content">
        	<c:if test="${empty param.my_action }">
	            <!-- 个人信息 -->
	            <div class="information" style="margin-top:10px;">
	                <p>昵称：</p><span>${USER_SESSION.unikename }</span><br>
	                <p>性别：</p><span>${USER_SESSION.usex }</span><br>
	                <p>院校：</p><span>${USER_SESSION.uschool }</span><br>
	                <p>QQ：</p><span>${USER_SESSION.qq }</span><br>
	                <p>Email：</p><span>${USER_SESSION.uemail }</span><br>
	                <p>个人简介：</p><span>${USER_SESSION.umsg }</span><br>
	                <a href="my.jsp?my_action=update"><button>修改个人信息</button></a>
	            </div>
			</c:if>
			
			<c:if test="${param.my_action eq 'update' }">
	            <!-- 修改个人信息 -->
	            <div class="update">
	                <form action="updateUser" method="POST">
	                    <p>昵称：</p><span>${USER_SESSION.unikename }</span><br>
	                    <p>性别：</p><input type="radio" name="usex" value="男" checked="checked"/>男&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="sex" value="女"/>女<br>
	                    <p>院校：</p><input type="text" name="uschool" value="${USER_SESSION.uschool }"/><br>
	                    <p>QQ：</p><input type="text" name="qq" value="${USER_SESSION.qq }"/><br>
	                    <p>Email：</p><input type="text" name="uemail" value="${USER_SESSION.uemail }"/><br>
	                    <p>个人简介：</p><input type="text" name="umsg" value="${USER_SESSION.umsg }"/><br>
	                    <button type="submit">保&nbsp;&nbsp;存</button>
	                </form>
	            </div>
			</c:if>
			
			<c:if test="${param.my_action eq 'publish' }">
	            <!-- 已发布 -->
	            <ul>
		            <c:forEach items="${losts }" var="lost">
		            <li class="publish">
		            	<a href="showLost?lostId=${lost.lid }&cpage=cpage" style="text-decoration:none;border:none;color:#333">
		            		<span>
				                <img src="${lost.limg }" alt=""/>
				                <p class="title">${lost.ltitle }</p>
				                <p class="text">${lost.lmsg }</p>
				                <p class="date">${lost.ldate }&nbsp;&nbsp;&nbsp;&nbsp;</p>
				           	</span>
				        </a>
				    	<a href="deleteLost?lid=${lost.lid }" class="aaa">删除</a>
				    </li>
		            </c:forEach>
		    	</ul>
			</c:if>

			<c:if test="${param.my_action eq 'news' }">
	            <!-- 消息列表 -->
	            <c:forEach items="${newsList }" var="news">
				    	<div class="news">
					        <p class="send">发送人：<a href="toSendNews?rid=${news.send.uid }">${news.send.unikename }</a></p>
					        <p class="text">${news.nmsg }</p>
			                <p class="date">${news.ndate }&nbsp;&nbsp;&nbsp;&nbsp;<a href="deleteNews?nid=${news.nid }&del=del">删除</a></p>
				        </div>
		    	</c:forEach>
				<c:if test="${!empty newsList}">
					<div>
						<span class="page" style="margin-left: 65px;"><a href="showNews?set=top">首页</a></span>
						<span class="page"><a href="showNews?set=sub">上一页</a></span>
						<span class="page">第&nbsp;${news_page.getStart()}&nbsp;页</span>
						<span class="page"><a href="showNews?set=add">下一页</a></span>
						<span class="page"><a href="showNews?set=bottom">尾页</a></span>
						<span class="page" style="width: 140px;margin-bottom: 50px;">共&nbsp;${news_page.getTotalPage()}&nbsp;页&nbsp;${news_page.getTotal()}&nbsp;条数据</span>
					</div>
				</c:if>
			</c:if>

        <br><br><br><br>
        </div>
    </div>
</body>
</html>